package cnpm02.j2ee.group3.model;

import static javax.persistence.CascadeType.MERGE;
import static javax.persistence.CascadeType.PERSIST;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.validator.NotNull;

@Entity
@Table(name = "LANGUAGE_TRANSLATION", uniqueConstraints = @UniqueConstraint(columnNames = {
                "LanguageId", "Language"}))
@AttributeOverride(name = "id", column = @Column(name = "LanguageTranslationId"))
public class LanguageTranslation extends AbstractTranslationEntity {
	private static final long serialVersionUID = 7369567281357755358L;

	@ManyToOne(cascade = {PERSIST, MERGE})
	@JoinColumn(name = "LanguageId", nullable = false)
	@NotNull
	private Language language;

	public LanguageTranslation() {
		super();
	}

	public LanguageTranslation(Language _language, SupportedLanguage _lang,
			String _translation) {
		super(_lang, _translation);
		language = _language;
	}

	public void setLanguage(Language language) {
		this.language = language;
	}

	public Language getLanguage() {
		return language;
	}
}
